package cn.iocoder.yudao.framework.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

import java.util.Objects;

/**
 * 笔试类型枚举
 */
@Getter
@AllArgsConstructor
public enum WrittenExamTypeEnum {

//    INDUSTRY(1, "企业行测题/测评/银行"),
//    IT(2, "IT行业笔试题"),
//    OTHER(3, "其他"),

    TECH(1, "技术类", "技术类（java、python等计算机专业类问题，适用于技术类岗位）"),
    COMMON(2, "通用类", "通用类（行测、综合知识等，适用于企业测评、银行国企类笔试）"),

    ;

    private Integer code;
    private String value;
    private String desc;

    public static WrittenExamTypeEnum getByCode(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        for (WrittenExamTypeEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static WrittenExamTypeEnum getByDesc(String desc) {
        if (StringUtils.isEmpty(desc)) {
            return null;
        }
        for (WrittenExamTypeEnum value : values()) {
            if (value.desc.equals(desc)) {
                return value;
            }
        }
        return null;
    }

}
